FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 5250
EXPOSE 5251

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY src/apigateway/dreamwork.apigateway.api/dreamwork.apigateway.api.csproj src/apigateway/dreamwork.apigateway.api/
RUN dotnet restore src/apigateway/dreamwork.apigateway.api/dreamwork.apigateway.api.csproj
COPY . .
WORKDIR /src/src/apigateway/dreamwork.apigateway.api
RUN dotnet build dreamwork.apigateway.api.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish dreamwork.apigateway.api.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "dreamwork.apigateway.api.dll"]
